import {tableOptBtnConfig} from "../table";
import {commonConfig} from '@/config/common';
import {tableTextColumnMap} from "@/utils";

export default {
  "tableId": "command",
  "name": "设备命令",
  "columns": [
    {
      label: '命令编号',
      children: [
        {
          key: 'commandNo',
        },
      ]
    },
    {
      label: '命令名称',
      width: 200,
      children: [
        {
          key: 'commandName',
          tooltip: true
        },
      ],
    },
    {
      label: '命令类型',
      children: [
        {
          key: 'commandType',
          mapFunc: (data) => tableTextColumnMap(data, commonConfig.commandType)
        },
      ]
    },
    {
      label: '命令方向',
      children: [
        {
          key: 'commandOrientation',
          mapFunc: (data) => tableTextColumnMap(data, commonConfig.commandOrientation)
        }
      ],
    },
    {
      label: '解析方式',
      width: 100,
      children: [
        {
          key: 'analyzeWay',
          mapFunc: (data) => tableTextColumnMap(data, commonConfig.analyzeWay)
        }
      ],
    },
    {
      label: '控制协议码流',
      width: 150,
      children: [
        {
          key: 'reqStreamStr',
          class: 'font-color-warning',
          tooltip: true
        }
      ],
    },
    {
      label: '响应协议码流',
      width: 150,
      children: [
        {
          key: 'rspStreamStr',
          class: 'font-color-warning',
          tooltip: true
        }
      ],
    },
    {
      label: '最小控制间隔',
      width: 120,
      children: [
        {
          key: 'minCtrInterval',
        }
      ],
    },
    {
      label: '等待时长',
      children: [
        {
          key: 'waitingTime',
        }
      ],
    },
    {
      label: '备注',
      children: [
        {
          key: 'remarks',
        }
      ],
    },
    {
      label: '更新时间',
      width: 100,
      children: [
        {
          updatedDate: true
        }
      ],
    },
    {
      "label": "操作",
      "operation": true,
      "width": 220,
      "children": [
        {
          "button": true,
          type: tableOptBtnConfig.edit.type,
        },
        {
          "button": true,
          type: tableOptBtnConfig.copy.type,
          class: 'hover-success',
        },
        {
          "button": true,
          type: tableOptBtnConfig.delete.type,
          class: 'hover-danger',
        }
      ]
    }
  ],
  "filters": [
    {
      "fieldType": "string",
      key: 'commandType',
      label: '命令类型',
      options: commonConfig.commandType
    },
    {
      "fieldType": "string",
      key: 'commandOrientation',
      label: '命令方向',
      options: commonConfig.commandOrientation
    },
    {
      "fieldType": "string",
      key: 'analyzeWay',
      label: '解析方式',
      options: commonConfig.analyzeWay
    },
    {
      "fieldType": "input",
      key: 'commandName',
      label: '命令名称',
    },
    {
      "fieldType": "input",
      key: 'remarks',
      label: '备注',
    },
  ]
}
